package c.f.b.a.a.a.b;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.FrameLayout.LayoutParams;
import android.widget.TextView;
import com.huawei.hms.game.h0;

public class e extends TextView {
    public e(Context context) {
        super(context, null, 16842884);
    }

    public int getBadgeGravity() {
        return ((LayoutParams) getLayoutParams()).gravity;
    }

    public void setBadgeCount(String str) {
        setText(str);
    }

    public void setBadgeGravity(int i) {
        LayoutParams layoutParams = (LayoutParams) getLayoutParams();
        layoutParams.gravity = i;
        setLayoutParams(layoutParams);
    }

    public void setBadgeLayoutParams(f fVar) {
        LayoutParams layoutParams = (LayoutParams) getLayoutParams();
        if (layoutParams != null && fVar != null) {
            layoutParams.rightMargin = h0.a(getContext(), (float) fVar.c);
            layoutParams.leftMargin = h0.a(getContext(), (float) fVar.d);
            layoutParams.topMargin = h0.a(getContext(), (float) fVar.e);
            layoutParams.bottomMargin = h0.a(getContext(), (float) fVar.f);
            setLayoutParams(layoutParams);
        }
    }

    public void setTargetView(View view) {
        if (getParent() != null) {
            ((ViewGroup) getParent()).removeView(this);
        }
        if (view != null && (view.getParent() instanceof ViewGroup)) {
            ViewGroup viewGroup = (ViewGroup) view.getParent();
            int indexOfChild = viewGroup.indexOfChild(view);
            viewGroup.removeView(view);
            FrameLayout frameLayout = new FrameLayout(getContext());
            ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
            frameLayout.setLayoutParams(layoutParams);
            view.setLayoutParams(new ViewGroup.LayoutParams(-1, -1));
            viewGroup.addView(frameLayout, indexOfChild, layoutParams);
            frameLayout.addView(view);
            frameLayout.addView(this);
        }
    }
}
